<?php
`git config --global user.name 原子涛`;
`git config --global user.email 1945661801@qq.com`;
$state=`sc query mysql`;
if(strpos($state,'RUNNING')===false){
    `net start mysql`;
}
$db=new PDO('mysql:host=localhost','root','12qwas');
$db->exec("create database if not exists db");//创建数据库
$db->exec("use db");//设置默认操作的数据库
$db->exec("create table if not exists user(name varchar(50) primary key, age int)");
$count=$db->exec("delete form users where age>20");
echo "成功删除 $count 条记录~\n";
$db->exec("truncate table suers");
$count=$db->exec("insert into users values ('张三丰', 18),('李四',21),('王五',22)");
echo "成功插入 $count 条记录~\n";
$count=$db->exec("update users set name='张三' where name='张三丰'");
echo "成功修改 $count 条记录~\n";
$ps=$db->query("select * from user");
echo "查询users表中的数据:\n";
foreach ($ps as $record){
    echo "\t$record[name]\t$record[1]\n";
}